Skip to content

fix: keep same-named photos' sidecars and other XMP intact, follow the engine's port, escape menu text, start Windows shims directly - #22

Merged
nodemode-ai merged 6 commits into
mainfrom
fix/review-2026-11-28
Nov 29, 2026
Merged

nodemode-ai merged 6 commits into
mainfrom
fix/review-2026-11-28

Conversation

@gbarnai

@gbarnai gbarnai commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • A JPEG, TIFF or DNG beside a raw file of the same name no longer reads, writes, renames, moves, deletes, imports, exports or copies that raw file's .xmp sidecar. It keeps its own metadata in the file instead. Save Metadata for such a file is refused with a message when writing metadata into files is off.
  • Import, move and rename never replace a sidecar that is already at the destination. A move import keeps the source sidecar if it could not be copied.
  • Saving metadata into a file or a sidecar keeps the XMP fields formlit does not write, such as motion photo, panorama and gain map data, with their original namespace prefixes. Export still applies its include and remove filters.
  • Exporting an original, or a DNG whose metadata cannot go into the file, no longer overwrites the sidecar of a same-named raw file in the export folder. Copying photos into a new catalog takes a sidecar only with the photo that owns it.
  • The engine writes the port it chose into its lock file. The stdio MCP bridge uses FORMLIT_MCP_URL, then that port, then 8390.
  • Preset names, group names and optgroup headings are escaped or set as text before they are shown in menus.
  • On Windows, a .cmd agent program that is an npm shim is now started as its node script, or as the program it names, without cmd.exe. Any other .cmd or .bat still goes through cmd.exe /c, which now refuses control characters, percent signs, double quotes, cmd special characters in unquoted words, and a program path that would need quotes. The shared agent finder becomes 1.0.2 and its hash is recorded in setup/agents.py.
  • Tests: backend/tests/test_shared_sidecars.py, backend/tests/test_mcp_bridge_port.py and backend/tests/test_agent_start_windows.py. They fail before the change.
  • Test plan: [x] backend pytest (437 passed; the 9 failures also fail on main) [x] frontend type check and build [x] engine selfcheck and health probe [ ] Playwright window smoke in CI [ ] a Windows check of Chat and Codex tabs started from an npm-installed shim
  • On Windows, an agent program that is not an npm shim is still started through cmd.exe. Any argument holding & | < > ^ ( ) ! % " or a control character is now refused there, whether or not the argument has spaces. The message suggests passing long text through standard input or a file.
  • npm .cmd shims keep starting directly as their node script or wrapped program, with no command interpreter.
  • Unit tests cover both paths on any OS by testing the argv builder with a fake Windows environment.
  • The recorded hash for shared finder version 1.0.2 is updated to match.

Tests

  • Each fix has a test that fails on the previous code where practical.
  • The repo CI commands were run locally on macOS. Every failure seen locally also fails on main in the same environment (missing local tools or platform-specific tests); none is introduced here.
  • Please rely on this PR's CI run for Linux and Windows.

For the owner

  • A few related items need an owner decision; they are listed separately, not here.

How to ship

  • Independent of other repos; merge in any order. No version bump; release as usual.

The engine notes its port in its lock file; the bridge reads it there and
falls back to 8390 when there is none.
A JPEG, TIFF or DNG beside a raw file of the same name no longer reads,
writes, renames, moves or deletes that raw file's .xmp sidecar; it keeps
its metadata in the file. Import and move never replace a sidecar that is
already at the destination. Saving metadata into a file or a sidecar keeps
the XMP fields formlit does not write, such as motion photo, panorama and
gain map data.
….exe

A .cmd or .bat agent program is started as the node script or program its npm shim names. A file that is not such a shim still goes through cmd.exe /c, which now refuses control characters, percent signs, double quotes, special characters in unquoted words and a program path that needs quotes. The shared finder becomes 1.0.2.
Exporting an original or a DNG beside a raw of the same name puts the metadata in the file instead of replacing the raw file's sidecar, and copying photos into a new catalog takes a sidecar only with the photo that owns it.
… spaces

A word given to cmd.exe /c is refused when it holds any of & | < > ^ ( ) ! % " or a control character, quoted or not, since a batch file reads its arguments again. The message asks for long text through standard input or a file. npm shims are still started directly as their node script or program. The recorded hash for the shared finder 1.0.2 follows.
@gbarnai
gbarnai requested a review from nodemode-ai as a code owner November 29, 2026 18:18
@nodemode-ai
nodemode-ai merged commit 7cdc39b into main Nov 29, 2026
5 checks passed
@nodemode-ai
nodemode-ai deleted the fix/review-2026-11-28 branch November 29, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants